package com.example.waibao.config;//package com.example.sannong.config;
//
//
//import com.alibaba.druid.pool.DruidDataSource;
//import com.alibaba.druid.support.http.StatViewServlet;
//import com.alibaba.druid.support.http.WebStatFilter;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.boot.web.servlet.FilterRegistrationBean;
//import org.springframework.boot.web.servlet.ServletRegistrationBean;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import javax.sql.DataSource;
//import java.util.Arrays;
//
//@Configuration
//public class DruidConfig {
//
//
//    @ConfigurationProperties(prefix = "spring.datasource")
//    @Bean
//    public DataSource druidDataSource(){
//        return new DruidDataSource();
//    }
//
//    @Bean
//    public ServletRegistrationBean statViewServlet(){
//        ServletRegistrationBean bean = new ServletRegistrationBean(new StatViewServlet(),
//                "/druid/*");
//
//        bean.addInitParameter("allow","");
//        bean.addInitParameter("deny","192.155.13.223");
//        bean.addInitParameter("loginUsername", "admin");
//        bean.addInitParameter("loginPassword","123456");
//        return bean;
//    }
//
//    //druid监控过滤器配置
//    @Bean
//    @ConditionalOnMissingBean
//    public FilterRegistrationBean webStatFilter(){
//        FilterRegistrationBean bean = new FilterRegistrationBean();
//
//        bean.setFilter(new WebStatFilter());
//        bean.addInitParameter("exclusions","*.js,*.css,/druid/*,/jdbc/*");
//
//        bean.setUrlPatterns(Arrays.asList("/*"));
//        return bean;
//    }
//
//}
